<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>首页</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../css/public.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form">
		<input type="hidden" name="id" id="id" />
		<div class="layui-form-item">
			<div class="layui-inline">
				<div class="layui-form-item">过期时间</div>
			  	<input type="text" class="layui-input" id="test1">
			</div>
		</div>
		<div class="layui-form-item center">
			<span class="layui-btn" onclick="btn_edit_date()">更改时间</span>
		</div>
	</form>
	<script type="text/javascript" src="../layui/layui.js"></script>
	<script src="../js/cache.js"></script>
	<script>
		var $;
		layui.use(['layer','laydate'],function(){
		    	$ = layui.jquery;
		    var layer = layui.layer ,laydate = layui.laydate;
		    laydate.render({
			    elem: '#test1',
			    format: 'yyyy-MM-dd HH:mm:ss',
				done: function(value, date, endDate){
				}
			});
		})
		//修改
		function btn_edit_date(){
			var time = dateTo($("#test1").val())
			console.log(time)
			$.ajax({
			  type: 'post',
			  url: baseUrl+"/admin/update",
			  data: {'id': $("#id").val() , "exetime" : dateTo($("#test1").val()) },
			  dataType: 'json',
			  success: function(res){
			  	if(res.status == 0){
			  		layer.msg(''+res.msg+'',{icon:1,time:1500});
			  		setTimeout(function(){
			  			parent.location.reload();
			  		},1500)
			  	}else {
			  		layer.msg(''+res.msg+'',{icon:2,time:1500});
			  		return;
			  	}
			  }
			});
		}
	</script>
</body>
</html>